{extend name='admin@main'}


{block name="content"}

<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off" id="Newform">
    <div class="layui-card-body padding-left-40">
        <!--
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">姓名</span>


                <div id="nickname" class="xm-select-demo"></div>


            </label>
        </div>
        -->
		
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">姓名</span>
                <span class="color-desc margin-left-5"></span>
					{if isset($vo) and isset($vo.name)}
					<input type="text" maxlength="20" autocomplete="off" required name="name" value='{$vo.name|default="-"}' readonly class="layui-input" >
					{else}
                    <select class="layui-select" lay-verify="required"  required name="name" lay-search id="name" lay-filter="name">
                        <option value="">请选择</option>
                        {foreach $list as $k=>$v}
                        {eq name='$vo.name' value='$v["nickname"].""'}
                        <option selected value="{$v["nickname"]}" readonly>{$v["nickname"]}</option>
                        {else}
                        <option value="{$v["nickname"]}">{$v["nickname"]}</option>
                        {/eq}
                        {/foreach}
                    </select>
					{/if}

            </label>
            <p class="help-block">
			{if isset($vo) and isset($vo.name)}
			当前的值班：{$user_rs.zhiban}天，已休：{$user_rs.zhibanbuxiu}天，加班：{$user_rs.jiaban}天，已休：{$user_rs.jiabanbuxiu}天
			{/if}
			</p>
        </div>	
		
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">类型</span>
                <span class="color-desc margin-left-5"></span>
                    <select name="datetype" lay-verify="required" lay-search="" required>
                      <option value="">请选择</option>
                      <option value="zhiban" {eq name='$vo.datetype' value='zhiban'}selected{/eq} >值班</option>
                      <option value="jiaban" {eq name='$vo.datetype' value='jiaban'}selected{/eq} >加班</option>

                    </select>

            </label>
        </div>



        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">加班/值班日期</span>
                <span class="color-desc margin-left-5"></span>
                <input type="text" name="otdate" id="otdate" data-date-input="date" required lay-verify="date" placeholder="加班/值班日期" autocomplete="off" class="layui-input" value='{$vo.otdate|default=""}'>
            </label>
        </div>
		
		
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">换休天数</span>
                <span class="color-desc margin-left-5"></span>
                <input type="text" maxlength="20" autocomplete="off" required name="buxiunum" value='{$vo.buxiunum|default="0.0"}' placeholder="换休天数" class="layui-input" pattern="^[0-9]+(.[0|5]{1})?$" >
            </label>
            <p class="color-desc">天数(只能填写整数1,2,3,4或小数0.5,1.5,2.5,3.5等）</p>
        </div>
		

		
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">文件附件</span>
				<input name="files" id="files" class="layui-input" value="{$vo.files|default=''}" readonly>
                <button type="button" class="layui-btn layui-btn-sm" id="file_attach"><i class="layui-icon"></i>上传文件</button>
            </label>
			<p class="color-desc">{if $vo.files !=''}<a href="{$vo.files}" target="new">查看附件</a>{/if}</p>
        </div>
		
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">备注</span>
                <span class="color-desc margin-left-5"></span>
                <textarea placeholder="请输入备注" class="layui-textarea" name="remark">{$vo.remark|default=""}</textarea>
            </label>
			<p class="color-desc"></p>
        </div>
			
		
		
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

</form>
{/block}

{block name='script'}

<script src="__ROOT__/static/plugs/laydate/laydate.js"></script>
<script src="__ROOT__/static/plugs/select/xm-Select.js"></script>
<script>
    window.form.render();
    
    layui.use(['form', 'layedit', 'laydate','upload'], function(){
      var form = layui.form
      ,layer = layui.layer
      ,layedit = layui.layedit
      ,laydate = layui.laydate
	  ,upload = layui.upload;

	  upload.render({ //允许上传的文件后缀
		elem: '#file_attach'
		,url: '{:url("upload")}'
		,accept: 'file' //普通文件
		,exts: 'pdf|jpg|gif|doc|docx|zip|rar|7z' //只允许上传的文件
		,done: function(res, index, upload) {
		  console.log(res)
		  $("#files").attr("value", res.url);
		}
	  });



    });
</script>
{/block}